<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>冻结Vue中的数据</title>
</head>
<body>
    <h1>冻结Vue中的数据</h1>
    <div style="color:gray">
        <p><code>Object.freeze()</code>冻结Vue中的数据。</p>
        <pre>data.a = 2 // 不起作用</pre>
    </div>
    <div>
        <a href="/">回目录</a>
    </div>
    <hr>
    <div id="app">
        {{ a }}
    </div>
    <script src="/node_modules/vue/dist/vue.js"></script>
    <script>
        var data = { a : 1 };
        Object.freeze(data)

        var app = new Vue({
            el: "#app",
            data: data
        });
    </script>    
</body>
</html>